<?php
require_once 'Zend/Application/Resource/ResourceAbstract.php';
require_once 'Zend/Oauth/Consumer.php';
require_once 'Zend/Oauth/Token/Access.php';
require_once 'Zend/Oauth/Client.php';

class Core_Application_Resource_CouchDB
	extends Zend_Application_Resource_ResourceAbstract
{
	/**
	 * Private cache of configured Couch DB Instances
	 */
	private $_cache;
	
	/**
	 * Defined by Zend_Application_Resource_Resource
	 *
	 * @return Object
	 */
	public function init()
	{
		$options = $this->getOptions();
		
		foreach ($options as $name => $config )
		{
			$couch = Core_DocDb_Couch::factory($config);
			$this->_cache[$name] = $couch;
		}

		return $this;
	}
	
	public function getInstance($name)
	{
		return $this->_cache[$name];
	}
}